package com.genexususa.eo.google.test.campaign;


import com.genexususa.eo.google.connection.CampaignManager;
import com.genexususa.eo.google.test.Constants;

public class ConsumeCreateCampaign {

    public static void main(String[] args){

        String xml = "<GA_Campaign xmlns=\"L2TMediaDev_L2T1.51\">\n" +
                "\t<Budgets>\n" +
                "\t<Budget>\n" +
                "\t\t<Id>0</Id>\n" +
                "\t\t<BudgetGxId>655</BudgetGxId>\n" +
                "\t\t<Name>Budget Test #2</Name>\n" +
                "\t\t<Period>D</Period>\n" +
                "\t\t<Amount>15.70</Amount>\n" +
                "\t\t<DeliveryMethod>A</DeliveryMethod>\n" +
                "\t\t<Status>A</Status>\n" +
                "\t\t<Shared>false</Shared>\n" +
                "\t\t<SubCampaigns>\n" +
                "\t\t\t<SubCampaign>\n" +
                "\t\t\t\t<Id>0</Id>\n" +
                "\t\t\t\t<SubCampaignGXId>707</SubCampaignGXId>\n" +
                "\t\t\t\t<Name>Test Campaign Diego #26</Name>\n" +
                "\t\t\t\t<Status>A</Status>\n" +
                "\t\t\t\t<ServingStatus/>\n" +
                "\t\t\t\t<StartDate>2015-07-18</StartDate>\n" +
                "\t\t\t\t<EndDate>2015-09-08</EndDate>\n" +
                "\t\t\t\t<BiddingStrategyConfiguration>\n" +
                "\t\t\t\t\t<BiddingScheme>\n" +
                "\t\t\t\t\t\t\t<BSManualCPC>\n" +
                "\t\t\t\t\t\t\t\t<enhancedCpcEnabled>false</enhancedCpcEnabled>\n" +
                "\t\t\t\t\t\t\t</BSManualCPC>\n" +
                "\t\t\t\t\t\t</BiddingScheme>" +
                "\t\t\t\t</BiddingStrategyConfiguration>\n" +
                "\t\t\t\t<AdServingOptimizationStatus/>\n" +
                "\t\t\t\t<FrequencyCap>\n" +
                "\t\t\t\t\t<FreqImpressions>0</FreqImpressions>\n" +
                "\t\t\t\t\t<FreqLevel/>\n" +
                "\t\t\t\t\t<FreqTimeUnit/>\n" +
                "\t\t\t\t</FrequencyCap>\n" +
                "\t\t\t\t<Settings>\n" +
                "\t\t\t\t\t<GeoTargetTypeSetting>\n" +
                "\t\t\t\t\t\t<GeoTargetPositiveType>L</GeoTargetPositiveType>\n" +
                "\t\t\t\t\t\t<GeoTargetNegativeType>D</GeoTargetNegativeType>\n" +
                "\t\t\t\t</GeoTargetTypeSetting>\n" +
                "\t\t\t\t<KeywordMatch>\n" +
                "\t\t\t\t\t<match>true</match>\n" +
                "\t\t\t\t</KeywordMatch>\n" +
                "\t\t\t\t<RealTimeBidding>\n" +
                "\t\t\t\t\t<realtime>false</realtime>\n" +
                "\t\t\t\t</RealTimeBidding>\n" +
                "\t\t\t\t<TargetRestrict>\n" +
                "\t\t\t\t\t<UseAdGroup>false</UseAdGroup>\n" +
                "\t\t\t\t</TargetRestrict>\n" +
                "\t\t\t\t<DynamicSearchAds>\n" +
                "\t\t\t\t\t<DomainName>www.hello.com</DomainName>\n" +
                "\t\t\t\t\t<LanguageCode>en</LanguageCode>\n" +
                "\t\t\t\t</DynamicSearchAds>\n" +
                "\t\t\t\t</Settings>\n" +
                "\t\t\t\t<NetworkSetting>\n" +
                "\t\t\t\t\t<NetworkGoogleSearch>true</NetworkGoogleSearch>\n" +
                "\t\t\t\t\t<NetworkSearchNetwork>true</NetworkSearchNetwork>\n" +
                "\t\t\t\t\t<NetworkContentNetwork>true</NetworkContentNetwork>\n" +
                "\t\t\t\t\t<NetworkPartnerSearchNetwork>false</NetworkPartnerSearchNetwork>\n" +
                "\t\t\t\t</NetworkSetting>\n" +
                "\t\t\t\t<AdvertisingChannelType>CONTENT</AdvertisingChannelType>\n" +
                "\t\t\t</SubCampaign>\n" +
                "\t\t</SubCampaigns>\n" +
                "\t\t</Budget>\n" +
                "\t</Budgets>\n" +
                "</GA_Campaign>";

       /* String xml = "<GA_Campaign xmlns=\"L2TMediaTrunk\">\n" +
                "\t<Budgets xmlns=\"L2T_L2T1.5\">\n" +
                "\t\t<Budget xmlns=\"L2T_L2T1.5\">\n" +
                "\t\t\t<Id xmlns=\"L2TMediaTrunk\">186373258</Id>\n" +
                "            <BudgetGxId xmlns=\"L2TMediaTrunk\">959</BudgetGxId>\n" +
                "            <Name xmlns=\"L2TMediaTrunk\">test genexus Shared Budget</Name>\n" +
                "            <Period xmlns=\"L2TMediaTrunk\">D</Period>\n" +
                "            <Amount xmlns=\"L2TMediaTrunk\">56.25</Amount>\n" +
                "            <DeliveryMethod xmlns=\"L2TMediaTrunk\">A</DeliveryMethod>\n" +
                "            <Status xmlns=\"L2TMediaTrunk\">A</Status>\n" +
                "            <Shared xmlns=\"L2TMediaTrunk\">true</Shared>\n" +
                "            <SubCampaigns xmlns=\"L2TMediaTrunk\">\n" +
                "\t\t\t\t<SubCampaign xmlns=\"L2TMediaTrunk\">\n" +
                "\t\t\t\t\t<Id>0</Id>\n" +
                "                    <SubCampaignGXId>964</SubCampaignGXId>\n" +
                "                    <Name>Branded/Ford</Name>\n" +
                "                    <Status>A</Status>\n" +
                "                    <ServingStatus/>\n" +
                "                    <StartDate>2014-07-16</StartDate>\n" +
                "                    <EndDate>2014-04-30</EndDate>\n" +
                "                    <BiddingStrategyConfiguration>\n" +
                "\t\t\t\t\t\t<BiddingScheme>\n" +
                "\t\t\t\t\t\t\t<BSEnhancedCPC>\n" +
                "\t\t\t\t\t\t\t\t<BiddingId>0</BiddingId>\n" +
                "                            </BSEnhancedCPC>\n" +
                "                        </BiddingScheme>\n" +
                "                    </BiddingStrategyConfiguration>\n" +
                "                    <AdServingOptimizationStatus/>\n" +
                "                    <FrequencyCap>\n" +
                "                    <FreqImpressions>2</FreqImpressions>\n" +
                "\t\t\t\t\t\t<FreqLevel>A</FreqLevel>\n" +
                "                        <FreqTimeUnit>D</FreqTimeUnit>\n" +
                "                    </FrequencyCap>\n" +
                "                    <Settings>\n" +
                "\t\t\t\t\t\t<GeoTargetTypeSetting>\n" +
                "\t\t\t\t\t\t\t<GeoTargetPositiveType>D</GeoTargetPositiveType>\n" +
                "\t\t\t\t\t\t\t<GeoTargetNegativeType>D</GeoTargetNegativeType>\n" +
                "\t\t\t\t\t\t</GeoTargetTypeSetting>\n" +
                "\t\t\t\t\t\t<KeywordMatch>\n" +
                "\t\t\t\t\t\t\t<match>true</match>\n" +
                "\t\t\t\t\t\t</KeywordMatch>\n" +
                "\t\t\t\t\t\t<RealTimeBidding>\n" +
                "\t\t\t\t\t\t\t<realtime>false</realtime>\n" +
                "\t\t\t\t\t\t</RealTimeBidding>\n" +
                "\t\t\t\t\t\t<TargetRestrict>\n" +
                "\t\t\t\t\t\t\t<UseAdGroup>true</UseAdGroup>\n" +
                "\t\t\t\t\t\t</TargetRestrict>\n" +
                "                    </Settings>\n" +
                "                    <NetworkSetting>\n" +
                "\t\t\t\t\t\t<NetworkGoogleSearch>true</NetworkGoogleSearch>\n" +
                "\t\t\t\t\t\t<NetworkSearchNetwork>true</NetworkSearchNetwork>\n" +
                "\t\t\t\t\t\t<NetworkContentNetwork>false</NetworkContentNetwork>\n" +
                "\t\t\t\t\t\t<NetworkPartnerSearchNetwork>false</NetworkPartnerSearchNetwork>\n" +
                "                    </NetworkSetting>\n" +
                "                    <AdvertisingChannelType/>\n" +
                "                </SubCampaign>\n" +
                "            </SubCampaigns>\n" +
                "        </Budget>\n" +
                "    </Budgets>\n" +
                "</GA_Campaign>\n";  */

        CampaignManager cm = new CampaignManager();
        cm.SetClientId(Constants.testAccountEmiliano);

        String res = cm.CreateCampaign(xml);

        cm.Finalize();

        System.out.println(res);

    }
}
